package com.aki.ai_property.controller;

import com.aki.ai_property.entity.Clean;
import com.aki.ai_property.service.intf.CleanService;
import com.aki.ai_property.vo.PageBean;
import com.aki.ai_property.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 34553
 * @date 2022/8/28
 */
@RestController
@RequestMapping("/api/clean/")
public class CleanController {
    @Autowired
    private CleanService service;

    /** 新增 */
    @PostMapping("/save.do")
    public Result save(Clean clean){
        return service.save(clean);
    }

    /** 修改 */
    @PostMapping("/update.do")
    public Result update(Clean clean){
        return service.update(clean);
    }

    /** 删除 */
    @PostMapping("/delete.do")
    public Result delete(int id){
        return service.delete(id);
    }

    //查询
    @GetMapping("page.do")
    public PageBean page(String name, int page, int limit){
//        return PageBean.ok(service.selectPage(nam);
        return service.selectPage(name, page, limit);
    }

    /** 查询总条数 */
    @GetMapping("all.do")
    public Result all(){
        return service.all();
    }
}
